
import { Schema, Document, model } from 'mongoose'
interface User extends Document {
    name: string, //名字
    password: string,//密码
    email: string,//邮箱
    createTime?: Date
}

const userSchema = new Schema({
    name: { type: String, required: [true, '名字不能为空'] },
    password: { type: String, required: [true, '密码不能为空'] },
    email: { type: String, required: [true, '邮箱不能为空'] },
    createTime: { type: Date, default: Date.now }
})
export default model<User>('users', userSchema)

